package model

import "time"

type Configuration struct {
	App      App      `mapstructure:"app" json:"app" yaml:"app"`
	Router   Router   `mapstructure:"router" json:"router" yaml:"router"`
	Postgres Postgres `mapstructure:"postgres" json:"postgres" yaml:"postgres"`
	Redis    Redis    `mapstructure:"redis" json:"redis" yaml:"redis"`
	Jwt      Jwt      `mapstructure:"jwt" json:"jwt" yaml:"jwt"`
	Logger   Logger   `mapstructure:"logger" json:"logger" yaml:"logger"`
}

type App struct {
	Host           string `mapstructure:"host" json:"host" yaml:"host"`
	Port           string `mapstructure:"port" json:"port" yaml:"port"`
	AppName        string `mapstructure:"app_name" json:"app_name" yaml:"app_name"`
	AppUrl         string `mapstructure:"app_url" json:"app_url" yaml:"app_url"`
	DefaultCaptcha string `mapstructure:"default_captcha" json:"default_captcha" yaml:"default_captcha"`
}

type Router struct {
	Version []string `mapstructure:"version" json:"version" yaml:"version"`
}

type Postgres struct {
	Host     string `mapstructure:"host" json:"host" yaml:"host"`
	Port     string `mapstructure:"port" json:"port" yaml:"port"`
	User     string `mapstructure:"user" json:"user" yaml:"user"`
	Password string `mapstructure:"password" json:"password" yaml:"password"`
	DbName   string `mapstructure:"db_name" json:"db_name" yaml:"db_name"`
	SslMode  string `mapstructure:"ssl_mode" json:"ssl_mode" yaml:"ssl_mode"`
	TimeZone string `mapstructure:"time_zone" json:"time_zone" yaml:"time_zone"`
}

type Redis struct {
	Host      string        `mapstructure:"host" json:"host" yaml:"host"`
	Port      string        `mapstructure:"port" json:"port" yaml:"port"`
	DB        int           `mapstructure:"db" json:"db" yaml:"db"`
	ExpiresAt time.Duration `mapstructure:"expires_at" json:"expires_at" yaml:"expires_at"`
}

type Jwt struct {
	Secret    string `mapstructure:"secret" json:"secret" yaml:"secret"`
	Issuer    string `mapstructure:"issuer" json:"issuer" yaml:"issuer"`
	Subject   string `mapstructure:"subject" json:"subject" yaml:"subject"`
	Audience  string `mapstructure:"audience" json:"audience" yaml:"audience"`
	ExpiresAt int64  `mapstructure:"expires_at" json:"expires_at" yaml:"expires_at"`
	RefreshAt int64  `mapstructure:"refresh_at" json:"refresh_at" yaml:"refresh_at"`
	NotBefore int64  `mapstructure:"not_before" json:"not_before" yaml:"not_before"`
}

type Logger struct {
	Development string `mapstructure:"development" json:"development" yaml:"development"`
	Filepath    string `mapstructure:"filepath" json:"filepath" yaml:"filepath"`
}
